#ifndef MagicCube_H
#define MagicCube_H
#include "Cube.h"
#include "stdafx.h"
class MagicCube
{
public:
	MagicCube(GLfloat xpos,GLfloat ypos,GLfloat zpos,GLfloat cubeLenght);
	void GetNextState(char vector,int x,int y,int z,GLfloat &statex,GLfloat &statey,GLfloat &statez);
	void GetPosition(GLfloat angel,GLfloat px,GLfloat py,GLfloat pz, GLfloat &outX,GLfloat &outy,GLfloat &outz);
	void Draw(GLfloat vx,GLfloat vy,GLfloat vz,GLfloat index,GLfloat angel);
	void AddWoirdRotation(GLdouble angle, GLdouble x, GLdouble y, GLdouble z );
	void TransformWorldPosition(GLfloat x,GLfloat y,GLfloat z);
	void DrawRefCoordinate();
	void Reset();
	GLfloat *GetWorldMatrix();
	GLfloat *GetPositionMatrix();
	~MagicCube(void);
private :
	void MergeCubeFaces(int x,int y,int z,int index,int direction);
	void InitTexture();
	AUX_RGBImageRec *LoadBMP(char *fileName);
	GLfloat xPostion;
	GLfloat yPostion;
	GLfloat zPostion;
	static const int DivNumber=3;
	Cube* magicCubes[DivNumber][DivNumber][DivNumber];
	GLfloat worldMatirx[4][4];
	GLfloat positionMatrix[4][4];
	GLuint texture[6];
};
#endif


